#include "CollectResults.h"

CollectResults::CollectResults(std::string name, std::string description)
{
	this->name = name;
	this->description = description;
	average = 0;
}

void CollectResults::start()
{
	start_tick_counts.push_back(tbb::tick_count::now());
}

void CollectResults::stop()
{
	stop_tick_counts.push_back(tbb::tick_count::now());
}

void CollectResults::calculateAverages()
{
	for(int index_tick_counts = 0; index_tick_counts < start_tick_counts.size(); index_tick_counts++)
	{
		averages.push_back((stop_tick_counts.at(index_tick_counts) - start_tick_counts.at(index_tick_counts)).seconds()); 
	}

	for(int index_average = 0; index_average< averages.size(); index_average++)
	{
		average += averages.at(index_average);
	}
	average = average / averages.size();
}

std::string CollectResults::getName()
{
	return name;
}

std::string CollectResults::getDescription()
{
	return description;
}

float CollectResults::getAverage()
{
	return average;
}